<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noodp" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
        <title>障碍物检测 | Ahhh.fun</title>
        <meta name="Description" content="这是一个基于激光雷达的障碍物检测项目"><meta property="og:title" content="障碍物检测" />
<meta property="og:description" content="这是一个基于激光雷达的障碍物检测项目" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://ainy.gitee.io/obstacle-detector/" />
<meta property="article:published_time" content="2019-08-25T16:22:42+08:00" />
<meta property="article:modified_time" content="2020-04-19T21:19:34+08:00" /><meta property="og:site_name" content="Ahhh.fun" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="障碍物检测"/>
<meta name="twitter:description" content="这是一个基于激光雷达的障碍物检测项目"/>
<meta name="theme-color" content="#ffffff">
<meta name="msapplication-TileColor" content="#da532c">
<link rel="canonical" href="https://ainy.gitee.io/obstacle-detector/" />
<link rel="shortcut icon" type="image/x-icon" href="https://ainy.gitee.io/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="https://ainy.gitee.io/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://ainy.gitee.io/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://ainy.gitee.io/favicon-16x16.png">
<link rel="manifest" href="https://ainy.gitee.io/site.webmanifest">
<link rel="mask-icon" href="https://ainy.gitee.io/safari-pinned-tab.svg" color="#5bbad5"><link rel="next" href="https://ainy.gitee.io/share/" /><link rel="stylesheet" href="https://ainy.gitee.io/lib/fontawesome-free/all.min.css"><link rel="stylesheet" href="https://ainy.gitee.io/lib/animate/animate.min.css"><link rel="stylesheet" href="https://ainy.gitee.io/css/style.min.css"><script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "headline": "障碍物检测",
        "inLanguage": "zh-CN",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "https:\/\/ainy.gitee.io\/obstacle-detector\/"
        },"image": {
                "@type": "ImageObject",
                "url": "https:\/\/ainy.gitee.io\/cover.png",
                "width":  800 ,
                "height":  600 
            },"genre": "posts","keywords": "科研, 分享","wordcount":  3261 ,
        "url": "https:\/\/ainy.gitee.io\/obstacle-detector\/","datePublished": "2019-08-25","dateModified": "2020-04-19","license": "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.","publisher": {
                "@type": "Organization",
                "name": "Jie",
                "logo": {
                "@type": "ImageObject",
                "url": "https:\/\/ainy.gitee.io\/logo.png",
                "width":  127 ,
                "height":  40 
                }
            },"author": {
                "@type": "Person",
                "name": "Jie"
            },"description": "这是一个基于激光雷达的障碍物检测项目"
    }
    </script></head>
    <body><script>
            if (!window.localStorage || !window.localStorage.getItem('theme')) {window.isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;} else {
                window.isDark = (window.localStorage && window.localStorage.getItem('theme')) === 'dark';
            }
            window.isDark && document.body.classList.add('dark-theme');
        </script><div class="wrapper"><header class="desktop" id="header-desktop">
    <div class="header-wrapper">
        <div class="header-title">
            <a href="https://ainy.gitee.io/">Ahhh.fun</a>
        </div>
        <div class="menu"><a class="menu-item" href="https://ainy.gitee.io/posts/" rel="noopener noreffer">文章</a><a class="menu-item" href="https://ainy.gitee.io/tags/" rel="noopener noreffer">标签</a><a class="menu-item" href="https://ainy.gitee.io/categories/" rel="noopener noreffer">分类</a><a class="menu-item" href="https://ainy.gitee.io/categories/documentation/" rel="noopener noreffer">文档</a><a class="menu-item" href="https://ainy.gitee.io/about/" rel="noopener noreffer">关于</a><a class="menu-item" href="https://gitee.com/ainy/ainy" title="GitHub" rel="noopener noreffer" target="_blank"><i class='fab fa-github fa-fw'></i></a><span class="menu-item">|</span>
            <a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                <i class="fas fa-adjust fa-fw"></i>
            </a><a href="javascript:void(0);" class="menu-item" title="选择语言">简体中文<i class="fas fa-chevron-right fa-fw"></i>
                    <select class="language-select" id="language-select-desktop" onchange="location = this.value;"><option value="/en/obstacle-detector/">English</option><option value="/obstacle-detector/" selected>简体中文</option></select>
                </a></div>
    </div>
</header><header class="mobile" id="header-mobile">
    <div class="header-wrapper">
        <div class="header-container">
            <div class="header-title">
                <a href="https://ainy.gitee.io/">Ahhh.fun</a>
            </div>
            <div class="menu-toggle" id="menu-toggle-mobile">
                <span></span><span></span><span></span>
            </div>
        </div>
        <div class="menu" id="menu-mobile"><a class="menu-item" href="https://ainy.gitee.io/posts/" title="" rel="noopener noreffer">文章</a><a class="menu-item" href="https://ainy.gitee.io/tags/" title="" rel="noopener noreffer">标签</a><a class="menu-item" href="https://ainy.gitee.io/categories/" title="" rel="noopener noreffer">分类</a><a class="menu-item" href="https://ainy.gitee.io/categories/documentation/" title="" rel="noopener noreffer">文档</a><a class="menu-item" href="https://ainy.gitee.io/about/" title="" rel="noopener noreffer">关于</a><a class="menu-item" href="https://gitee.com/ainy/ainy" title="GitHub" rel="noopener noreffer" target="_blank"><i class='fab fa-github fa-fw'></i></a><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                <i class="fas fa-adjust fa-fw"></i>
            </a><a href="javascript:void(0);" class="menu-item" title="选择语言">简体中文<i class="fas fa-chevron-right fa-fw"></i>
                    <select class="language-select" onchange="location = this.value;"><option value="/en/obstacle-detector/">English</option><option value="/obstacle-detector/" selected>简体中文</option></select>
                </a></div>
    </div>
</header>

<script>
    window.desktopHeaderMode = "fixed";
    window.mobileHeaderMode = "auto";
</script>
<main class="main">
                <div class="container"><article class="page single"><h1 class="single-title animated flipInX">障碍物检测</h1><div class="post-meta">
            <div class="post-meta-line"><span class="post-author"><a href="https://ainy.gitee.io/" title="Author" rel="noopener noreffer author" class="author"><i class="fas fa-user-circle fa-fw"></i>Jie</a>
</span>&nbsp;
                    <span class="post-category">收录于<a href="https://ainy.gitee.io/categories/%E6%96%87%E6%A1%A3">
                                <i class="far fa-folder fa-fw"></i>文档
                            </a></span></div>
            <div class="post-meta-line"><i class="far fa-calendar-alt fa-fw"></i><time datetime=2019-08-25>2019-08-25</time>&nbsp;
                <i class="fas fa-pencil-alt fa-fw"></i>约 3261 字&nbsp;
                <i class="far fa-clock fa-fw"></i>预计阅读 7 分钟&nbsp;<span id="/obstacle-detector/" class="leancloud_visitors" data-flag-title="障碍物检测">
                        <i class="far fa-eye fa-fw"></i><span class=leancloud-visitors-count></span>&nbsp;次阅读
                    </span>&nbsp;</div>
        </div><div class="toc" id="toc-auto">
                <h2 class="toc-title">目录</h2>
                <div class="toc-content" id="toc-content-auto"></div>
            </div>
            <div class="toc" id="toc-static">
                <details>
                    <summary>
                        <div class="toc-title">
                            <span>目录</span>
                            <span><i class="details icon fas fa-angle-down"></i></span>
                        </div>
                    </summary>
                    <div class="toc-content" id="toc-content-static"><nav id="TableOfContents">
  <ul>
    <li><a href="#摘要">摘要</a></li>
    <li><a href="#1-the-nodes-and-nodelets">1. The nodes and nodelets</a>
      <ul>
        <li><a href="#11-the-scans_merger-node">1.1. The scans_merger node</a></li>
        <li><a href="#12-the-obstacle_extractor-node">1.2. The obstacle_extractor node</a></li>
        <li><a href="#13-the-obstacle_tracker-node">1.3. The obstacle_tracker node</a></li>
        <li><a href="#14-the-obstacle_publisher-node">1.4. The obstacle_publisher node</a></li>
      </ul>
    </li>
    <li><a href="#2-the-messages">2. The messages</a></li>
    <li><a href="#3-the-launch-files--启动文件">3. The launch files  启动文件</a></li>
    <li><a href="#4-the-displays">4. The displays</a></li>
  </ul>
</nav></div>
                </details>
            </div><div class="content" id="content"><h2 id="摘要">摘要</h2>
<p><code>obstacle_detector</code>包提供了用于检测和跟踪障碍物的实用程序，其数据源由2D激光雷达提供，检测到的障碍物以线段或圆圈的形式呈现。该包用于配备了两个激光雷达的机器人，因此它包含几个额外的实用程序。<code>resources</code>文件夹中提供的文章描述了该方法的工作原理。</p>
<p>该软件包依赖<a href="http://arma.sourceforge.net" target="_blank" rel="noopener noreffer">Armadillo C++库</a>
进行编译和运行。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/27595825-0abe4338-5b5e-11e7-8438-ffdeec4e9cef.png" alt="Visual example of obstacle detector output."/>
  <br/>
  Fig. 1. 障碍物检测结果
</p>
<hr>
<ol>
<li>The nodes and nodelets
<ul>
<li>The scans_merger</li>
<li>The obstacle_extractor</li>
<li>The obstacle_tracker</li>
<li>The obstacle_publisher</li>
</ul>
</li>
<li>The messages</li>
<li>Launch files</li>
<li>The displays</li>
</ol>
<h2 id="1-the-nodes-and-nodelets">1. The nodes and nodelets</h2>
<p>该包提供的nodes/nodelets相互独立，都可以单独完成障碍物检测。在一般解决方案中，数据处理顺序如下：</p>
<p><code>two laser scans</code> -&gt; <code>scans merger</code> -&gt; <code>merged scan or pcl</code> -&gt; <code>obstacle extractor</code> -&gt; <code>obstacles</code> -&gt; <code>obstacle tracker</code> -&gt; <code>refined obstacles</code></p>
<p>对于某些情况，直接从激光扫描数据中提取障碍物就足够了，不必跟踪。</p>
<p>可以使用ROS参数服务器配置节点参数。所有节点都提供私有<code>params</code>服务，允许进程从参数服务器获取最新参数。</p>
<p>所有节点都可以处于活动或睡眠模式，这通过在参数服务器中设置适当的变量并调用<code>params</code>服务来触发。在睡眠模式下，任何订阅者或发布者都会关闭，节点什么都不会做直到再次激活。</p>
<p>为了便于使用，建议使用相应的Rviz面板。Rviz面板通过参数服务器和服务端-客户端调用进行通信，因此必须保持节点的名称不变（参见示例的启动文件）。</p>
<h3 id="11-the-scans_merger-node">1.1. The scans_merger node</h3>
<p>两个消息类型为<code>sensor_msgs/LaserScan</code>的话题<code>front_scan</code>和<code>rear_scan</code>，通过这一节点，被融合成话题为<code>scan</code>的单一激光数据源（也可被融合成类型为<code>sensor_msgs/PointCloud</code>的话题<code>pcl</code>）。两者之间的区别在于，<code>pcl</code>会将相同对<code>scan</code>进行相同数据的合并。</p>
<p>首先对输入激光数据进行校正，以便及时补偿激光雷达的运动（参见<code>laser_geometry</code>包）。接下来，获得的两个PCL数据会被同步转换到目标坐标系。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/27595821-0aa3519a-5b5e-11e7-9ce0-8f48db4592e4.gif" alt="Visual example of scans_merger output"/>
  <br/>
  Fig. 2. 激光数据融合
</p>
<hr>
<p>我们需要先知道两个激光雷达坐标系关于特定坐标系（例如<code>robot</code>）的相对变换。假设两个激光雷达的坐标系分别为<code>front_scanner</code>和<code>rear_scanner</code>，则必须提供从<code>robot</code>系到<code>front_scanner</code>系和从<code>robot</code>系到<code>rear_scanner</code>系的转换。该节点允许人为地将测量点限制在<code>robot</code>系周围的特定矩形区域，以及限制激光数据源的范围。在该区域外的点将被丢弃。</p>
<p>即使仅使用一个激光雷达，该节点也可用于简单的数据预处理，例如纠正、范围限制或转换到不同的参考坐标系。该节点使用以下本地参数：</p>
<ul>
<li><code>~active</code> (<code>bool</code>, default: <code>true</code>) - 活动/睡眠模式，</li>
<li><code>~publish_scan</code> (<code>bool</code>, default: <code>false</code>) - 是否发布融合的激光扫描消息，</li>
<li><code>~publish_pcl</code> (<code>bool</code>, default: <code>true</code>) - 是否发布融合的点云消息，</li>
<li><code>~ranges_num</code> (<code>int</code>, default: <code>1000</code>) - 360度激光扫描消息中包含的范围数（圆形扇区），</li>
<li><code>~min_scanner_range</code> (<code>double</code>, default: <code>0.05</code>) - 生成的激光扫描数据的最小允许值，</li>
<li><code>~max_scanner_range</code> (<code>double</code>, default: <code>10.0</code>) - 生成的激光扫描数据的最大允许值，</li>
<li><code>~min_x_range</code> (<code>double</code>, default: <code>-10.0</code>) - 矩形范围限制（限制外的坐标点将被丢弃），</li>
<li><code>~max_x_range</code> (<code>double</code>, default: <code>10.0</code>) - 同上,</li>
<li><code>~min_y_range</code> (<code>double</code>, default: <code>-10.0</code>) - 同上,</li>
<li><code>~max_y_range</code> (<code>double</code>, default: <code>10.0</code>) - 同上,</li>
<li><code>~fixed_frame_id</code> (<code>string</code>, default: <code>map</code>) - 固定坐标系的名称（目标坐标系），</li>
<li><code>~target_frame_id</code> (<code>string</code>, default: <code>robot</code>) - 融合后激光雷达数据的坐标系名称。</li>
</ul>
<p>该节点的Rviz面板。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/28522255-97e2c210-7077-11e7-8ca1-556790b043e6.png" alt="Rviz panel for the scans_merger node."/>
  <br/>
  Fig. 3. scans_merger节点的Rviz面板
</p>
<hr>
<h3 id="12-the-obstacle_extractor-node">1.2. The obstacle_extractor node</h3>
<p>此节点将消息类型为<code>sensor_msgs/LaserScan</code>的话题<code>scan</code>或消息类型为<code>sensor_msgs/PointCloud</code>的话题<code>pcl</code>转换为障碍物，这些障碍物以自定义类型<code>obstacles_detector/Obstacles</code>发布在话题<code>raw_obstacles</code>下。必须以有角度的方式对PCL消息进行排序，因为该算法利用了激光雷达的极性。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/27595822-0aa50ab2-5b5e-11e7-8061-1da4b947b617.gif" alt="Visual example of obstacle_extractor output."/>
  <br/>
  Fig. 4. 障碍物检测
</p>
<hr>
<p>首先将输入点分组，并将子集标记为可见或不可见（如果一个组在相邻组的前面，则它是可见的，否则假定它被遮挡）。该算法从每个子集中提取片段数据。接下来，检查片段之间是否可能合并。然后从片段中提取圆形障碍物，如果可能的话也需要进行合并。产生的障碍物集可以转换为特定坐标系。</p>
<p>该节点可使用以下本地参数进行配置：</p>
<ul>
<li><code>~active</code> (<code>bool</code>, default: <code>true</code>) - 活动/睡眠模式</li>
<li><code>~use_scan</code> (<code>bool</code>, default: <code>false</code>) - 使用激光扫描信息</li>
<li><code>~use_pcl</code> (<code>bool</code>, default: <code>true</code>) - 使用点云消息（如果同时选择了<code>scan</code>和<code>pcl</code>，<code>scan</code>将具有优先级）</li>
<li><code>~use_split_and_merge</code> (<code>bool</code>, default: <code>true</code>) - 选择使用Split And Merge (true)算法来检测分段，还是使用End Point Fit(false)</li>
<li><code>~circles_from_visibles</code> (<code>bool</code>, default: <code>true</code>) - 仅从完全可见（未遮挡）的分段中检测圆形障碍物</li>
<li><code>~discard_converted_segments</code> (<code>bool</code>, default: <code>true</code>) - 不发布产生圆形的片段</li>
<li><code>~transform_coordinates</code> (<code>bool</code>, default: <code>true</code>) - 将障碍物的坐标转换到<code>frame_id</code>系下</li>
<li><code>~min_group_points</code> (<code>int</code>, default: <code>5</code>) - 构成要进一步处理的组的最小点数</li>
<li><code>~max_group_distance</code> (<code>double</code>, default: <code>0.1</code>) - 如果两点之间的距离大于此值，则开启一个新组</li>
<li><code>~distance_proportion</code> (<code>double</code>, default: <code>0.00628</code>) - 根据点的范围成比例地扩大点之间的允许距离（单位为弧度）</li>
<li><code>~max_split_distance</code> (<code>double</code>, default: <code>0.2</code>) - 如果组中的一个点比该值的前导线更远，则拆分该组</li>
<li><code>~max_merge_separation</code> (<code>double</code>, default: <code>0.2</code>) - 如果障碍物之间的距离小于此值，则考虑合并它们</li>
<li><code>~max_merge_spread</code> (<code>double</code>, default: <code>0.2</code>) - 如果它们的所有极值点都比这个值更接近引导线，则合并两个分段</li>
<li><code>~max_circle_radius</code> (<code>double</code>, default: <code>0.6</code>) - 如果圆的半径大于此值，则忽略它</li>
<li><code>~radius_enlargement</code> (<code>double</code>, default: <code>0.25</code>) - 通过此值人为地扩大圆半径</li>
<li><code>~frame_id</code> (<code>string</code>, default: <code>map</code>) - 障碍物参考的坐标系的名称（仅当<code>transform_coordinates</code>标志设置为true时使用）</li>
</ul>
<p>该节点的Rviz面板。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/28522256-97e4d0be-7077-11e7-81fa-c2fcaae944be.png" alt="Rviz panel for the obstacle_extractor node."/>
  <br/>
  Fig. 5. obstacle_extractor节点的Rviz面板
</p>
<hr>
<h3 id="13-the-obstacle_tracker-node">1.3. The obstacle_tracker node</h3>
<p>该节点使用卡尔曼滤波器跟踪和过滤圆形障碍物。它从话题<code>raw_obstacles</code>订阅自定义类型<code>obstacle_detector/Obstacles</code>的消息，并在话题<code>tracked_obstacles</code>下发布相同类型的消息。跟踪算法仅应用于圆形障碍物，因此发布消息中的线段列表只是原始线段的副本。跟踪的障碍物补充了关于其速度的附加信息。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/27595819-0aa1bc86-5b5e-11e7-80ed-90c9ea53f69f.gif" alt="Visual example of obstacle_tracker output."/>
  <br/>
  Fig. 6. 障碍物追踪.
</p>
<hr>
<p>节点以同步方式工作，默认频率为100Hz。如果调低这一频率，则跟踪器将对其进行过采样并使其位置和半径平滑。下面的本地参数可用于调整节点：</p>
<ul>
<li><code>~active</code> (<code>bool</code>, default: <code>true</code>) - 活动/睡眠模式</li>
<li><code>~copy_segments</code> (<code>bool</code>, default: <code>true</code>) - 将检测到的线段复制到跟踪的障碍物消息中</li>
<li><code>~loop_rate</code> (<code>double</code>, default: <code>100.0</code>) - 主循环速率，单位为Hz</li>
<li><code>~tracking_duration</code> (<code>double</code>, default: <code>2.0</code>) - 在缺少输入数据的情况下持续跟踪障碍物的时间（超多这一时间，跟踪的障碍物将从列表中移除）</li>
<li><code>~min_correspondence_cost</code> (<code>double</code>, default <code>0.3</code>) - 一致性检测的阈值</li>
<li><code>~std_correspondence_dev</code> (<code>double</code>, default <code>0.15</code>) - 一致性检测中椭圆位置的标准差</li>
<li><code>~process_variance</code> (<code>double</code>, default <code>0.01</code>) - 障碍物位置和半径的方差（卡尔曼滤波器的参数）</li>
<li><code>~process_rate_variance</code> (<code>double</code>, default <code>0.1</code>) - 障碍物值变化率的方差（卡尔曼滤波器参数）</li>
<li><code>~measurement_variance</code> (<code>double</code>, default <code>1.0</code>) - 障碍物的的测量方差（卡尔曼滤波器参数）</li>
<li><code>~frame_id</code> (<code>string</code>, default: <code>map</code>) - 描述障碍物的参考坐标系</li>
</ul>
<p>该节点的Rviz面板。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/27595823-0aa835a2-5b5e-11e7-9657-8cd129a50aa2.png" alt="Rviz panel for the obstacle_tracker node."/>
  <br/>
  Fig. 7. obstacle_tracker节点的Rviz面板.
</p>
<hr>
<h3 id="14-the-obstacle_publisher-node">1.4. The obstacle_publisher node</h3>
<p>辅助节点，允许在<code>obstacles</code>话题下以<code>obstacles_detector/Obstacles</code>类型发布一组虚拟圆形障碍物。该节点主要用于离线测试。以下参数用于配置节点：</p>
<ul>
<li><code>~active</code> (<code>bool</code>, default: <code>true</code>) - 活动/睡眠模式</li>
<li><code>~reset</code> (<code>bool</code>, default: <code>false</code>) - 重置障碍物运动计算的时间（由专用的Rviz面板使用）</li>
<li><code>~fusion_example</code> (<code>bool</code>, default: <code>false</code>) - 产生可以观察到融合的障碍物</li>
<li><code>~fission_example</code> (<code>bool</code>, default: <code>false</code>) - 产生可以观察到裂变的障碍物</li>
<li><code>~radius_margin</code> (<code>double</code>, default: <code>0.25</code>) - 以米为单位人为地将圆半径放大</li>
<li><code>~loop_rate</code> (<code>double</code>, default: <code>10.0</code>) - 主循环速率，单位为Hz</li>
<li><code>~frame_id</code> (<code>string</code>, default: <code>map</code>) - 障碍物的参考坐标系名称</li>
</ul>
<p>以下参数用于为节点提供一组障碍物：</p>
<ul>
<li><code>~x_vector</code> (<code>std::vector&lt;double&gt;</code>, default: <code>[]</code>) - 障碍物中心点的x坐标数组</li>
<li><code>~y_vector</code> (<code>std::vector&lt;double&gt;</code>, default: <code>[]</code>) - 障碍物中心点的y坐标数组</li>
<li><code>~r_vector</code> (<code>std::vector&lt;double&gt;</code>, default: <code>[]</code>) - 障碍物半径数组</li>
<li><code>~x_vector</code> (<code>std::vector&lt;double&gt;</code>, default: <code>[]</code>) - 障碍物中心点在x方向上的速度数组</li>
<li><code>~y_vector</code> (<code>std::vector&lt;double&gt;</code>, default: <code>[]</code>) - 障碍物中心点在y方向上的速度数组</li>
</ul>
<p>该节点的Rviz面板。</p>
<hr>
<p align="center">
  <img src="https://user-images.githubusercontent.com/1482514/28582779-f8de6fca-7166-11e7-8a52-e147cea89f87.png" alt="Rviz panel for the obstacle_publisher node."/>
  <br/>
  Fig. 8. obstacle_publisher节点的Rviz面板
</p>
<hr>
<h2 id="2-the-messages">2. The messages</h2>
<p>该包提供三种自定义消息类型。它们的所有数值均以SI标准提供。</p>
<ul>
<li><code>CircleObstacle</code>
<ul>
<li><code>geometry_msgs/Point center</code> - 圆形障碍物的中心</li>
<li><code>geometry_msgs/Vector3 velocity</code> - 圆形障碍物的线速度</li>
<li><code>float64 radius</code> - 增加了安全边缘的圆形障碍物半径</li>
<li><code>float64 true_radius</code> - 没有安全边缘的障碍物测量半径</li>
</ul>
</li>
<li><code>SegmentObstacle</code>
<ul>
<li><code>geometry_msgs/Point first_point</code> - 现段的起点（逆时针方向）</li>
<li><code>geometry_msgs/Point last_point</code> - 线段的终点</li>
</ul>
</li>
<li><code>Obstacles</code>
<ul>
<li><code>Header header</code></li>
<li><code>obstacle_detector/SegmentObstacle[] segments</code></li>
<li><code>obstacle_detector/CircleObstacle[] circles</code></li>
</ul>
</li>
</ul>
<h2 id="3-the-launch-files--启动文件">3. The launch files  启动文件</h2>
<p>提供的启动文件是快速使用<code>obstacle_detector</code>包的好例子，它们初始化了节点需要用到的所有参数。</p>
<ul>
<li><code>demo.launch</code> - 运行带有激光雷达数据的.bag文件，并使用适当配置了的Rviz启动所有节点。</li>
<li><code>nodes_example.launch</code> - 运行所有节点，并将其参数设置为默认值。</li>
<li><code>nodelets_example.launch</code> - 运行所有nodelets，并将其参数设置为默认值。</li>
</ul>
<h2 id="4-the-displays">4. The displays</h2>
<p>为了获得更好的视觉效果，准备了适用于<code>障碍物</code>消息的Rviz显示。通过它的属性，我们可以改变障碍物的颜色。</p>
<p>作者：
<em>Mateusz Przybyla</em></p>
<p>翻译：
吴昊、向杰</p></div><div class="post-footer" id="post-footer">
    <div class="post-info">
        <div class="post-info-line">
            <div class="post-info-mod">
                <span>本文于 2020-04-19 更新&nbsp;<a class="git-hash" href="https://gitee.com/ainy/ainy/commit/25d5237ea4c355053ecefd674a1ad9ea86b49efe" target="_blank" title="commit by Jie(maybe_happy@163.com) 25d5237ea4c355053ecefd674a1ad9ea86b49efe: init the blog">
                            <i class="fas fa-hashtag fa-fw"></i>25d5237</a></span>
            </div>
            <div class="post-info-license"></div>
        </div>
        <div class="post-info-line">
            <div class="post-info-md"></div>
            <div class="post-info-share">
                <span><a href="javascript:void(0);" title="分享到 Twitter" data-sharer="twitter" data-url="https://ainy.gitee.io/obstacle-detector/" data-title="障碍物检测" data-hashtags="科研,分享"><i class="fab fa-twitter fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Facebook" data-sharer="facebook" data-url="https://ainy.gitee.io/obstacle-detector/" data-hashtag="科研"><i class="fab fa-facebook-square fa-fw"></i></a><a href="javascript:void(0);" title="分享到 微博" data-sharer="weibo" data-url="https://ainy.gitee.io/obstacle-detector/" data-title="障碍物检测"><i class="fab fa-weibo fa-fw"></i></a><a href="javascript:void(0);" title="分享到 人人" data-sharer="renren" data-url="https://ainy.gitee.io/obstacle-detector/"><i class="fab fa-renren fa-fw"></i></a><a href="javascript:void(0);" title="分享到 百度" data-sharer="baidu" data-url="https://ainy.gitee.io/obstacle-detector/" data-title="障碍物检测"><i class="loveit it-baidu-fill"></i></a><a href="javascript:void(0);" title="分享到 Evernote" data-sharer="evernote" data-url="https://ainy.gitee.io/obstacle-detector/" data-title="障碍物检测"><i class="fab fa-evernote fa-fw"></i></a></span>
            </div>
        </div>
    </div>

    <div class="post-info-more">
        <section><i class="fas fa-tags fa-fw"></i>&nbsp;<a href="https://ainy.gitee.io/tags/%E7%A7%91%E7%A0%94">科研</a>,&nbsp;<a href="https://ainy.gitee.io/tags/%E5%88%86%E4%BA%AB">分享</a></section>
        <section>
            <span><a href="javascript:window.history.back();">返回</a></span>&nbsp;|&nbsp;<span><a href="https://ainy.gitee.io/">主页</a></span>
        </section>
    </div>

    <div class="post-nav">
            <a href="https://ainy.gitee.io/share/" class="next" rel="next" title="分享">分享<i class="fas fa-angle-right fa-fw"></i></a></div>
</div>
<div class="comment"><div id="valine"></div><script>
            document.addEventListener("DOMContentLoaded", function(event) {
                new Valine({
                    el: '#valine',
                    appId: 'QGzwQXOqs5JOhN4RGPOkR2mR-MdYXbMMI',
                    appKey: 'WBmoGyJtbqUswvfLh6L8iEBr',placeholder: '你的评论 ...',verify: true,avatar: 'mp',pageSize: 10,lang: 'zh-cn',visitor: true,recordIP: true,});
            });
        </script>
        <noscript>
            Please enable JavaScript to view the <a href="https://valine.js.org/">comments powered by Valine.</a>
        </noscript></div>
    </article></div>
            </main><footer class="footer">
    <div class="copyright"><div class="copyright-line">由 <a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a> 强力驱动 | 主题 - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer"><i class="far fa-heart fa-fw"></i> LoveIt</a>
        </div>

        <div class="copyright-line"><i class="far fa-copyright fa-fw"></i><span itemprop="copyrightYear">2019 - 2020</span><span class="author" itemprop="copyrightHolder">&nbsp;<a href="https://ainy.gitee.io/" target="_blank">Jie</a></span>&nbsp;|&nbsp;<span class="license"><a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a></span></div>
    </div>
</footer>
</div><a href="#" class="dynamic-to-top animated faster" id="dynamic-to-top">
            <i class="fas fa-chevron-up fa-fw"></i>
        </a><script>
        document.addEventListener('DOMContentLoaded', function () {
            lightGallery(document.getElementById('content'), {
                selector: '.lightgallery',
                speed: 400,
                hideBarsDelay: 2000,
                thumbnail: true,
                exThumbImage: 'data-thumbnail',
                thumbWidth: 80,
                thumbContHeight: 80,
            });
        });
    </script><script>
        document.addEventListener('DOMContentLoaded', function () {
            renderMathInElement(document.body, {
                delimiters: [
                    { left: '$$', right: '$$', display: true },
                    { left: '\\[', right: '\\]', display: true },{ left: '$', right: '$', display: false },
                    { left: '\\(', right: '\\)', display: false },],
                strict: false,
            });
        });
    </script><link rel="stylesheet" href="https://ainy.gitee.io/lib/valine/valine.css"><link rel="stylesheet" href="https://ainy.gitee.io/lib/iconfont/iconfont.min.css"><link rel="stylesheet" href="https://ainy.gitee.io/lib/lightgallery/lightgallery.min.css"><link rel="stylesheet" href="https://ainy.gitee.io/lib/katex/katex.min.css"><link rel="stylesheet" href="https://ainy.gitee.io/lib/katex/copy-tex.min.css"><script src="https://ainy.gitee.io/lib/valine/Valine.min.js"></script><script src="https://ainy.gitee.io/lib/smooth-scroll/smooth-scroll.polyfills.min.js"></script><script src="https://ainy.gitee.io/lib/sharer/sharer.min.js"></script><script src="https://ainy.gitee.io/lib/lazysizes/lazysizes.min.js"></script><script src="https://ainy.gitee.io/lib/lightgallery/lightgallery.min.js"></script><script src="https://ainy.gitee.io/lib/lightgallery/lg-thumbnail.min.js"></script><script src="https://ainy.gitee.io/lib/lightgallery/lg-zoom.min.js"></script><script src="https://ainy.gitee.io/lib/katex/katex.min.js"></script><script src="https://ainy.gitee.io/lib/katex/auto-render.min.js"></script><script src="https://ainy.gitee.io/lib/katex/copy-tex.min.js"></script><script src="https://ainy.gitee.io/lib/katex/mhchem.min.js"></script><script src="https://ainy.gitee.io/js/theme.min.js"></script></body>
</html>
